package com.lisp.springframework.web.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class CorsController {
	
	@CrossOrigin(origins = "https://www.baidu.com")
	@RequestMapping("/cors")
	@ResponseBody
	public String cors() {
		return "OK";
		// 打开www.baidu.com, 在开发者工具console用下面的脚本测试
		/*  $.ajax({
               url:"http://localhost:8080/springframework/hello",
               type:'GET',
               success:function (data) {
                   console.log(data);
               }
            })
		 */
	}
}
